package com.caits.lbs.framework.bean.common;

import java.io.Serializable;
import java.util.Date;

import com.caits.lbs.framework.Constants.Common;


/**
 * <p>ApiResultHead</p>
 * <p>通用的响应头对象</p>
 *
 * @author		周华彬(zhouhuabin@sinoiov.com, zhou_hua_bin@163.com)
 * @version		0.0.0
 * <table style="border:1px solid gray;">
 * <tr>
 * <th width="100px">版本号</th><th width="100px">动作</th><th width="100px">修改人</th><th width="100px">修改时间</th>
 * </tr>
 * <!-- 以 Table 方式书写修改历史 -->
 * <tr>
 * <td>0.0.0</td><td>创建类</td><td>admin</td><td>2017年6月29日 下午6:02:27</td>
 * </tr>
 * <tr>
 * <td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td>
 * </tr>
 * </table>
*/
public class ApiResultHead implements Serializable{
		/** 变量:TODO,类型:long */
		private static final long serialVersionUID = 3530199397160892132L;
		
		/** 变量:错误码  /1为失败，0为成功,类型:String */
		private String status = "0"; 
		/** 变量:失败的消息内容，如果成功则不返回此字段,类型:String */
		private String errorMessage = "";
		/** 变量:服务器返回时间,类型:String */
		private String responseTime = ""; 
		/** 变量:流水号,类型:String */
		private String sequenceCode = ""; 
		public String getStatus() {
			return status;
		}
		public void setStatus(String status) {
			this.status = status;
		}
		public String getErrorMessage() {
			return errorMessage;
		}
		public void setErrorMessage(String errorMessage) {
			this.errorMessage = errorMessage;
		}
		public String getResponseTime() {
			return responseTime;
		}
		public void setResponseTime(String responseTime) {
			this.responseTime = responseTime;
		}
		public String getSequenceCode() {
			return sequenceCode;
		}
		public void setSequenceCode(String sequenceCode) {
			this.sequenceCode = sequenceCode;
		}
		@Override
		public String toString() {
			return "Head [status=" + status + ", errorMessage=" + errorMessage
					+ ", responseTime=" + responseTime + ", sequenceCode="
					+ sequenceCode + "]";
		}
		
		
		
		public ApiResultHead() {
			super();
		}
		
		public ApiResultHead(String status) {
			super();
			this.status = status;
			this.responseTime = new Date().getTime()+"";
		}
		public ApiResultHead(String status, String errorMessage) {
			super();
			this.status = status;
			this.errorMessage = errorMessage;
			this.responseTime = new Date().getTime()+"";
		}
		
		public static ApiResultHead getSuccess(){
			ApiResultHead head =new ApiResultHead(Common.SUCCESS);
			return head;
		}
		public static ApiResultHead getERROR(String errorMsg){
			ApiResultHead head =new ApiResultHead(Common.ERROR,errorMsg);
			return head;
		}
		public static ApiResultHead getWARN(String errorMsg){
			ApiResultHead head =new ApiResultHead(Common.WARN,errorMsg);
			return head;
		}
		public static ApiResultHead getTOKENERROR(String errorMsg){
			ApiResultHead head =new ApiResultHead(Common.TOKENERROR,errorMsg);
			return head;
		}
		public static ApiResultHead getQUEUEERROR(String errorMsg){
			ApiResultHead head =new ApiResultHead(Common.QUEUEERROR,errorMsg);
			return head;
		}
		
		
}
